
#ifndef _MOTOR_H_
#define _MOTOR_H_

#include "main.h"

#define TIMx TIM3
#define TIMx_CLK_ENABLE  __HAL_RCC_TIM3_CLK_ENABLE()
#define TIM_COUNT 159
#define TIM_PRESCALER 999
#define PWM_CHANNEL_A TIM_CHANNEL_1
#define PWM_CHANNEL_B TIM_CHANNEL_2
#define PWM_GPIO_PORT GPIOA
#define PWM_GPIO_CLK_ENBALE __HAL_RCC_GPIOA_CLK_ENABLE()
#define PWM_GPIO_PIN_A GPIO_PIN_6
#define PWM_GPIO_PIN_B GPIO_PIN_7
#define Motor_A PWM_CHANNEL_A
#define Motor_B PWM_CHANNEL_B





void Motor_Init();

void TIM_PWM_Init();

void Set_DutyFactor(uint32_t channel,uint8_t dutyfactor);

void TIM_SetPWM_Pulse(uint32_t channel,int compare);

void Motor_SetAngle(uint32_t channel,uint16_t angle);

#endif